﻿using System;
using System.Diagnostics.CodeAnalysis;
using System.ServiceModel;
using Bookvar.ObjectModel;
using Bookvar.ObjectModel.Actions.Collaboration;

namespace Bookvar.Collaboration.ClientSide
{
    [ServiceContract( CallbackContract = typeof ( ICollaborationServiceCallback ), SessionMode = SessionMode.Required )]
    public interface ICollaborationService
    {
        [OperationContract( 
            AsyncPattern = true,
            Action = "http://tempuri.org/ICollaborationService/Join",
            ReplyAction = "http://tempuri.org/ICollaborationService/JoinResponse" )]
        IAsyncResult BeginJoin( string name, AsyncCallback callback, object asyncState );

        UserJoinResponse EndJoin( IAsyncResult result );

        [OperationContract( 
            IsOneWay = true, 
            IsInitiating = false,
            Action = "http://tempuri.org/ICollaborationService/Leave" )]
        void Leave();

        [OperationContract( 
            IsOneWay = true, 
            IsInitiating = false,
            Action = "http://tempuri.org/ICollaborationService/ProcessAction" )]
        void ProcessAction( ActionBase action );

        [SuppressMessage( "Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Used as a method in service contract.")]
        [OperationContract( 
            IsOneWay = false, 
            IsInitiating = false,
            Action = "http://tempuri.org/ICollaborationService/GetMindmap" )]
        MindMap GetMindmap();
    }
}